<?php
namespace app\course\validate\base;

use think\Validate;

/**
 * 用户验证
 */
class CourseSection extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'title'             => 'require',
        'material_id'       => 'require|number',
        'exams_id'          => 'require|number',
        'course_data_type'  => 'require|in:1,2,3,4',

    ];

    protected $field = [
        'title'             => '课时章节名称',
        'material_id'       => '资料ID',
        'exams_id'          => '考试ID',
        'course_data_type'  => '课时类型',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add_section'       => ['title', 'course_data_type'],    //, 'material_id', 'exams_id'
    ];

}
